<!--{template user/header}-->
<form id="auctiongoods" method="post" action="site.php?action=goods&type=update&aid=$aid">
<div style="border:solid 1px #ccc; background:#eee; color:#f00; height:31px; padding:6px 0 0 0; line-height:26px; text-align:left;">
	&nbsp;&nbsp;如果不设置，默认取当前城市最后写入数据库的今日团购商品
	<input type="submit" value="  提交  " class="formbutton" style="float:right;margin-right:6px;" />
</div>
<br/>
<!--{loop $list $py $acgs}-->
<div style="background:#eee; color:#f60; line-height:1.5em; padding:0 10px;font-weight:bold; font-size:16px; text-align:left; font-family:Arial;">
	$py
</div>
<table cellspacing="0" cellpadding="6" style="width:100%; text-align:left;">
	<!--{loop $acgs $acg}-->
	<tr>
		<td width="80" style="text-align:right;">
			$acg['city_name']：
			<input type="hidden" name="acg[{$acg['city_id']}][city_id]" value="$acg['city_id']" /></td>
		<td width="460">
			<select id="goods_select_$acg['city_id']" name="acg[{$acg['city_id']}][goods_id]" style="width:450px">
				<!--{if intval($acg['goods_id']) > 0}-->
				<option value="$acg['goods_id']">【{$acg['goods_city']}】$acg['goods_name']</option>
				<!--{else}-->
				<option value="0">搜索后选择</option>
				<!--{/if}-->
			</select>
		</td>
		<td>
			关键字：<input id="goods_key_$acg['city_id']" type="text" class="px" style="width:100px;" />&nbsp;<input cityID="$acg['city_id']" class="goods_search pn" type="button" value="  搜索  "/>
		</td>
	</tr>
	<!--{/loop}-->
</table>
<!--{/loop}-->
<br/>
<div style="border:solid 1px #ccc; background:#eee; color:#f00; height:31px; padding:6px 0 0 0; line-height:26px; text-align:left;">
	&nbsp;&nbsp;如果不设置，默认取当前城市最后写入数据库的今日团购商品
	<input type="submit" value="  提交  " class="formbutton" style="float:right;margin-right:6px;" />
</div>
</form>
<script type="text/javascript">
jQuery(function($){
	$(".goods_search").click(function(){
		var cityID = this.getAttribute("cityID");
		var keywords = $("#goods_key_"+cityID).val();
		
		$.ajax({
			type: "GET",
			cache:false,
			url: "site.php",
			data: "action=goods&type=search&aid=$aid&city_id="+cityID+"&keywords="+keywords,
			dataType:'json',
			success: function(data){
				$("#goods_select_"+cityID).html("");
				
				if(data.length > 0)
				{
					for(var i=0;i<data.length;i++)
					{
						var oOption = document.createElement("OPTION");
						oOption.text="【"+ data[i].city +"】"+data[i].name;
						oOption.value=data[i].id;
						$("#goods_select_"+cityID).get(0).add(oOption);
					}
				}
				else
				{
					var oOption = document.createElement("OPTION");
					oOption.text= '暂无相关团购';
					oOption.value= 0;
					$("#goods_select_"+cityID).get(0).add(oOption);
				}
			}
		});
	});
});
</script>
<!--{template user/footer}-->